package com.ems.vo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.util.Date;
import java.util.List;

/**
 * <p>
 * PCS数据
 * </p>
 * @author WuZH
 * @since 2024-04-23
 */
@Data
@ApiModel (value = "PcsEntity对象", description = "PCS数据")
public class PcsVo extends BaseVo {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty ("id")
    private String id;

    @ApiModelProperty ("工作状态: 0x6057 【停机，待机，运行，故障】	停机：全 0，表示停机； 开机中：Bit0 为 1，Bit2 为 0；待机：Bit0、Bit2 都为 1；（0 功率指令） 运行：Bit0、Bit3 都为 1 或 Bit0、Bit8 都为 1；（离网使能且设备在运行状态，判定为离网运行）故障：Bit6 为 1；")
    private Integer workStatus;

    @ApiModelProperty ("输出 AB 线电压")
    private String outABVoltage;

    @ApiModelProperty ("输出 BC 线电压")
    private String outBCVoltage;

    @ApiModelProperty ("输出 AC 线电压")
    private String outACVoltage;

    @ApiModelProperty ("A相电压")
    private String aVoltage;

    @ApiModelProperty ("B相电压")
    private String bVoltage;

    @ApiModelProperty ("C相电压")
    private String cVoltage;

    @ApiModelProperty ("A相电流")
    private String aCurrent;

    @ApiModelProperty ("B相电流")
    private String bCurrent;

    @ApiModelProperty ("C相电流")
    private String cCurrent;

    @ApiModelProperty ("电网频率")
    private String powerRate;

    @ApiModelProperty ("当前电网相序")
    private String powerSequence;

    @ApiModelProperty ("PCS降额系数")
    private String pcsDropRatio;

    @ApiModelProperty ("PCS 降额标志: 0：正常；1：IGBT 过温降额，2，环境温度降额，3：IGBT、环境温度都降额")
    private Integer pcsDropFlag;

    @ApiModelProperty ("交流 A 相有功功率")
    private String aActivePower;

    @ApiModelProperty ("交流 B 相有功功率")
    private String bActivePower;

    @ApiModelProperty ("交流 C 相有功功率")
    private String cActivePower;

    @ApiModelProperty ("交流 A 相视在功率")
    private String aApparentPower;

    @ApiModelProperty ("交流 B 相视在功率")
    private String bApparentPower;

    @ApiModelProperty ("交流 C 相视在功率")
    private String cApparentPower;

    @ApiModelProperty ("交流 A 相无功功率")
    private String aReactivePower;

    @ApiModelProperty ("交流 B 相无功功率")
    private String bReactivePower;

    @ApiModelProperty ("交流 C 相无功功率")
    private String cReactivePower;

    @ApiModelProperty ("交流输出总有功功率")
    private String acTotalActivePower;

    @ApiModelProperty ("交流输出总无功功率")
    private String acTotalReactivePower;

    @ApiModelProperty ("交流输出总视在功率")
    private String acTotalApparentPower;

    @ApiModelProperty ("交流功率因数")
    private String aCPowerFactor;

    @ApiModelProperty ("总母线电压")
    private String totalBusVoltage;

    @ApiModelProperty ("正母线电压")
    private String positiveBusVoltage;

    @ApiModelProperty ("负母线电压")
    private String negativeBusVoltage;

    @ApiModelProperty ("电池电流")
    private String batteryCurrent;

    @ApiModelProperty ("直流侧：电池电压")
    private String batteryVoltage;

    @ApiModelProperty ("直流侧：直流功率")
    private String dcPower;

    @ApiModelProperty ("直流侧：直流总电流")
    private String dcTotalCurrent;

    @ApiModelProperty ("IGBT 温度")
    private String iGBTTemp;

    @ApiModelProperty ("环境温度")
    private String ambientTemp;

    @ApiModelProperty ("电感温度")
    private String inductanceTemp;

    @ApiModelProperty ("当前实际充放电工作模式:1：交流电流源模式（恒流、恒功率），0：直流电压源模式（ACDC 源使用）")
    private Integer actualWorkModel;

    @ApiModelProperty ("A 相功率因数")
    private String aPowerFactor;

    @ApiModelProperty ("B 相功率因数")
    private String bPowerFactor;

    @ApiModelProperty ("C 相功率因数")
    private String cPowerFactor;

    @ApiModelProperty ("直流历史充电量")
    private String dcHistoryChargeCapacity;

    @ApiModelProperty ("直流日充电量，当日充电量")
    private String dcDayChargeCapacity;

    @ApiModelProperty ("直流历史放电量")
    private String dcHistoryDischargeCapacity;

    @ApiModelProperty ("直流日放电量，当日放电量")
    private String dcDayDischargeCapacity;

    @ApiModelProperty ("交流历史充电量")
    private String acHistoryChargeCapacity;

    @ApiModelProperty ("交流日充电量")
    private String acDayChargeCapacity;

    @ApiModelProperty ("交流历史放电量")
    private String acHistoryDischargeCapacity;

    @ApiModelProperty ("交流日放电量")
    private String acDayDischargeCapacity;

    @ApiModelProperty ("电感A相电流")
    private String inductanceACurrent;

    @ApiModelProperty ("电感B相电流")
    private String inductanceBCurrent;

    @ApiModelProperty ("电感C相电流")
    private String inductanceCCurrent;

    @ApiModelProperty ("子设备地址")
    private String deviceAddress;

    private Date createTime;

    private Integer isUsed;

    @ApiModelProperty ("警告字")
    private List<PcsAlarmBitVo> pcsAlarmBitVoList;

    @ApiModelProperty ("警告")
    private List<AlarmVo> alarmVoList;

    @ApiModelProperty("设备是否开机充电")
    private Integer connectStatus;

    public boolean check () {
        if ( StringUtils.isBlank ( this.getOutABVoltage () ) &&
                StringUtils.isBlank ( this.getOutBCVoltage () ) &&
                StringUtils.isBlank ( this.getOutACVoltage () ) &&
                StringUtils.isBlank ( this.getAVoltage () ) &&
                StringUtils.isBlank ( this.getBVoltage () ) &&
                StringUtils.isBlank ( this.getCVoltage () ) &&
                StringUtils.isBlank ( this.getACurrent () ) &&
                StringUtils.isBlank ( this.getBCurrent () ) &&
                StringUtils.isBlank ( this.getCCurrent () ) &&
                StringUtils.isBlank ( this.getPowerRate () ) &&
                StringUtils.isBlank ( this.getPowerSequence () ) &&
                StringUtils.isBlank ( this.getPcsDropRatio () ) &&
                StringUtils.isBlank ( this.getAActivePower () ) &&
                StringUtils.isBlank ( this.getBActivePower () ) &&
                StringUtils.isBlank ( this.getCActivePower () ) &&
                StringUtils.isBlank ( this.getAApparentPower () ) &&
                StringUtils.isBlank ( this.getBApparentPower () ) &&
                StringUtils.isBlank ( this.getCApparentPower () ) &&
                StringUtils.isBlank ( this.getAReactivePower () ) &&
                StringUtils.isBlank ( this.getBReactivePower () ) &&
                StringUtils.isBlank ( this.getCReactivePower () ) &&
                StringUtils.isBlank ( this.getAcTotalActivePower () ) &&
                StringUtils.isBlank ( this.getAcTotalApparentPower () ) &&
                StringUtils.isBlank ( this.getACPowerFactor () ) &&
                StringUtils.isBlank ( this.getTotalBusVoltage () ) &&
                StringUtils.isBlank ( this.getPositiveBusVoltage () ) &&
                StringUtils.isBlank ( this.getNegativeBusVoltage () ) &&
                StringUtils.isBlank ( this.getBatteryCurrent () ) &&
                StringUtils.isBlank ( this.getBatteryVoltage () ) &&
                StringUtils.isBlank ( this.getDcPower () ) &&
                StringUtils.isBlank ( this.getDcTotalCurrent () ) &&
                StringUtils.isBlank ( this.getIGBTTemp () ) &&
                StringUtils.isBlank ( this.getAmbientTemp () ) &&
                StringUtils.isBlank ( this.getInductanceTemp () ) &&
                StringUtils.isBlank ( this.getAPowerFactor () ) &&
                StringUtils.isBlank ( this.getBPowerFactor () ) &&
                StringUtils.isBlank ( this.getCPowerFactor () ) &&
                StringUtils.isBlank ( this.getDcHistoryChargeCapacity () ) &&
                StringUtils.isBlank ( this.getDcDayChargeCapacity () ) &&
                StringUtils.isBlank ( this.getDcHistoryDischargeCapacity () ) &&
                StringUtils.isBlank ( this.getDcDayDischargeCapacity () ) &&
                StringUtils.isBlank ( this.getAcHistoryChargeCapacity () ) &&
                StringUtils.isBlank ( this.getAcDayChargeCapacity () ) &&
                StringUtils.isBlank ( this.getAcHistoryDischargeCapacity () ) &&
                StringUtils.isBlank ( this.getAcDayDischargeCapacity () )

        ) {
            return false;
        }
        return true;
    }

}
